﻿using ArtMath.Core.Data;
using System;

namespace ArtMath.PointCollection
{
    [Serializable]
    public class OutCircle : ContinuityPoint
    {
        public PointD Center;
        public double Radius;
        public OutCircle()
        {

        }
        public OutCircle(PointD center, double r)
        {
            Center = center;
            Radius = r;
        }

        public override bool Contains(PointD pt)
        {
            return Center.DistanceTo(pt) > Radius && AfterContains(pt);
        }

        public override PointD? GetNearestPoint(PointD pt)
        {
            if (Center.DistanceTo(pt) > Radius) return pt;
            return Center.Offset(Center.GetAngle(pt), Radius);
        }

        protected override PointCollectionBase Intersect(PointCollectionBase collection)
        {
            return CustomIntersect(collection);
        }
    }
}
